package code.structure.manager.assist
{
	import code.structure.module.others.ProjectAssistController;
	
	import com.patience.mvc.context.Command;
	
	/**
	 *go 命令的操作 
	 * @author Yuri
	 * 
	 */
	public class GoManager implements ISpecialManager
	{
		private var _controller:ProjectAssistController;
		private var _command:Command;
		public function GoManager(c:ProjectAssistController)
		{
			controller = c;
		}
		
		/**
		 * 分析go命令 
		 * @param d
		 *  {“actiontype”:1,”actionid”:1,”parms”:[]}
		 */
		public function analyerGoCommand(d:Object):void{
			if(!d || !controller) return;
			if(!d.hasOwnProperty("actiontype") || !d.hasOwnProperty("actionid")  ) return;
			var actionType:int = int(d.actiontype);
			var actionid:int = int(d.actionid);
			var parms:Array;
			if(d.hasOwnProperty("parms")){
				if(typeof( d.parms) is String){
					parms = String(d.parms).split(",");
				}else{
					parms = d.parms as Array
				}
			}
			switch(actionType){
				/*case 1: //弹框
					if(!parms) return;
					springbordPopUI(actionid,parms);
					break;
				case 2://场景需求
					if(!parms) return;
					springbordScene(actionid,parms);
					break;
				case 3://好友
					springbordFriend(actionid,parms);
					break;
				case 4: //烹饪类型
					springbordCooking(actionid,parms);
					break;
				case 5: //特殊的一些操作
					springbordSpecial(actionid,parms)
					break;*/
			}
		}
		
		/**
		 *检测go命令有效性 
		 * @return 
		 * 
		 */
		public function checkGoValid(d:Object):Boolean{
				if(!d || !controller) return false;
				if(!d.hasOwnProperty("actiontype") || !d.hasOwnProperty("actionid")  ) return false;
				var actionType:int = int(d.actiontype);
				var actionid:int = int(d.actionid);
				var parms:Array;
				if(d.hasOwnProperty("parms")){
					if(typeof( d.parms) is String){
						parms = String(d.parms).split(",");
					}else{
						parms = d.parms as Array
					}
				}
				return true;
		}
		
		public function get controller():ProjectAssistController
		{
			return _controller;
		}
		
		public function set controller(value:ProjectAssistController):void
		{
			_controller = value;
		}
	}
}